import { http } from './request.js';

// 用户相关API
export const userApi = {
    // 获取用户信息
    getUserInfo() {
        return http.get('/user/info');
    },

    // 更新用户信息
    updateUserInfo(data) {
        return http.put('/user/profile', data);
    },

    // 上传头像
    uploadAvatar(file) {
        return http.post('/user/avatar', { file });
    },

    // 修改手机号
    changePhone(data) {
        return http.put('/user/phone', data);
    },

    // 修改邮箱
    changeEmail(data) {
        return http.put('/user/email', data);
    },

    // 获取用户积分
    getUserPoints() {
        return http.get('/user/points');
    },

    // 获取积分记录
    getPointsHistory(params) {
        return http.get('/user/points/history', params);
    },

    // 获取用户成长值
    getUserGrowth() {
        return http.get('/user/growth');
    },

    // 获取成长值记录
    getGrowthHistory(params) {
        return http.get('/user/growth/history', params);
    },

    // 获取用户活动记录
    getUserActivities(params) {
        return http.get('/user/activities', params);
    },

    // 退出登录
    logout() {
        return http.post('/auth/logout');
    }
}; 